function togglethis(obj) 
{
	if(obj.nextSibling.nodeType==3) 
		vis=obj.nextSibling.nextSibling.style; // Moz. Opera
	else 
		vis=obj.nextSibling.style; // IE
	if (vis.display == "block")
		{
			vis.display ="none";
			obj.innerHTML=obj.innerHTML.replace("collapse_closed","collapse_open");
		}
	else
		{
			vis.display ="block";
			obj.innerHTML=obj.innerHTML.replace("collapse_open","collapse_closed");
		}
}
function clickaway(obj) 
{
	vis=obj.style;
	vis.display = (vis.display == "block" ? "none" : "block");
}

var map;
var markers = [];
function initialize(divid, i_zoom, i_lat, i_lng, i_mapTypeId) {
  var mapOptions = {
    zoom: i_zoom,
    center: new google.maps.LatLng(i_lat,i_lng),
    mapTypeId: i_mapTypeId
  };

  map = new google.maps.Map(document.getElementById(divid), mapOptions);
 document.getElementById('mapViewZoom').value=i_zoom;
 document.getElementById('mapViewLat').value=i_lat;
 document.getElementById('mapViewLng').value=i_lng;
 document.getElementById('mapViewType').value=map.getMapTypeId();
 
  if (document.getElementById('EventForm_id').value!='0')
  {
	addMarker(new google.maps.LatLng(document.getElementById('EventForm_lat').value,document.getElementById('EventForm_lng').value));
	markers[0].setMap(map);
  }
  else 
  {
	addMarker(new google.maps.LatLng(i_lat,i_lng));
  }
  google.maps.event.addListener(map,'click',function(event) { 
	  document.getElementById('EventForm_lat').value = event.latLng.lat();
	  document.getElementById('EventForm_lng').value = event.latLng.lng();
	  document.getElementById('EventFormDiv').style.display="block";
	  markers[0].position=event.latLng;
	  markers[0].setMap(map);
 });
 google.maps.event.addListener(map,'zoom_changed', function(event){
	document.getElementById('mapViewZoom').value=map.getZoom();
 });
 google.maps.event.addListener(map,'center_changed', function(event){
	 document.getElementById('mapViewLat').value=map.getCenter().lat();
	 document.getElementById('mapViewLng').value=map.getCenter().lng();
 });
 google.maps.event.addListener(map,'maptypeid_changed', function(event){
	document.getElementById('mapViewType').value=map.getMapTypeId();
 });
 }
 

      // Add a marker to the map and push to the array.
      function addMarker(location) 
	  {
        marker = new google.maps.Marker({
          position: location,
          map: null
        });
        markers.push(marker);
      }


